<!--
/**************************************************
* @(#)organizationadd.jsp
*
* Copyright (c) 2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2005/2/28, owen
*  1) first release
   2) add javascript method changelist2,implemnt select jump
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8"%>
<html>
<head>
<title>新增产品种类</title>
<%@ include file="../common.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/caigouxitong.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<%
String exceptiondesc = (String)request.getAttribute("exception_desc");

	//String MaxMfID=(String)request.getAttribute("MaxMfID");
	//int getMaxMfID=Integer.parseInt(MaxMfID)+1;
%>
<%
if(message == null){
    %>
<script>
   <%
     if(exceptiondesc != null){
   %>
       alert("<%=exceptiondesc%>");
       
   <%
    }
   %>
   //返回
   function back(){
   // window.opener.location.reload();
    self.close();
   }
 
		
  	function check(){ 
  	     var iFields1 = new Array(2);
        iFields1[0] = 'gs_manufacture_category_id||产品种类编号||Y||1-20||#0';
        iFields1[1] = 'gs_manufacture_category_name||产品种类名称||Y||1-50||##';
        
       
        
		if( HiScript.value(checkform.name,iFields1) == false)  return false;
		
	    var category=document.checkform.gs_upper_manufacture_category.value;
	    var level=document.checkform.gs_manufacture_level.value;
	    
	    //alert(category.substring(0,1));
	    //alert(level);
	    if(level==1){
	      if(!(category.substring(0,1)==0&&level==1)){
	        alert("父级种类编号必须是无！");
	        return false;
	       }
	    }
	    else if(level==2){
	      if(!(category.substring(0,1)==1&&level==2)){
	        alert("父级种类编号必须是一级！");
	        return false;
	      }
	   }
	   else if(level==3){
	     if(!(category.substring(0,1)==2&&level==3)){
	       alert("父级种类编号必须是二级！");
	       return false;
	      }
	   }
	
	     //checkform.action="<%= response.encodeURL(request.getContextPath() + "/A400204.do") %>";   
		 //document.checkform.submit();
		  
	    //alert("产品分类新增成功！");
	    //window.opener.location.reload();
		//self.close();
		var ary = new Array(5);
            ary[0] = checkform.gs_manufacture_category_id.value;
            ary[1] = checkform.gs_manufacture_category_name.value;
            ary[2] = checkform.gs_manufacture_level.value;
            ary[3] = checkform.gs_upper_manufacture_category.value;
            ary[4] = checkform.gs_manufacture_desc.value;
			window.returnValue = ary;
			window.close();
		
	}
	
	
		
		</script>


</head>
<body onload="document.checkform.gs_manufacture_category_name.focus();" BGCOLOR="#f2f2f2" text="#000000" leftmargin="0" topmargin="0"  marginwidth="0" marginheight="0">
<p><br>
</p>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td height="20">
		<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<tr height="20">
				<td height="20" width="1" class="mtxt_black">&nbsp;</td>
				<td height="30" width="758" class="mtxt_black">新增产品种类</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="bg_line" height="2"></td>
	</tr>
</table>

<br>

<!--新增产品种类--------------------------------------------------------------------------------------------------------------------------->
<form name="checkform" method="post">



<table width="90%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td>
		
		<table class=bg_table id=tableId cellspacing=1 cellpadding=0
			style="padding-left:5;padding-right:5" width=100% align=center
			border=0>
			<TR class="bg_column" height=20>
				<TD colspan="4">产品种类信息</TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right width="20%">产品种类编号</TD>
				<TD align=left width="30%">
				<input type=text name="gs_manufacture_category_id" maxlength="50" size=30 value="" />
				<font color='red'>&nbsp;*</font>
				</TD>
				<TD align=right width="20%">产品种类名称</TD>
				<TD align=left width="30%">
				<input type=text name="gs_manufacture_category_name" maxlength="50" size=30 />
				<font color='red'>&nbsp;*</font>
			    </TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right>产品种类级别</TD>
				<TD align=left>
				<select name="gs_manufacture_level">	
						<option value="1">1</option>				
						<option value="2">2</option>
                        <option value="3">3</option>
				</select>
				
				</TD>
				<TD align=right>父级种类编号</TD>
				<TD align=left>
				<%ArrayList tCategoryLevel = (ArrayList)request.getAttribute("CategoryLevel"); %>
				<select name="gs_upper_manufacture_category">			
				     <option value="0">------无------</option>		
						<%
							if(tCategoryLevel != null && tCategoryLevel.size() > 0 ){
								
								String lvl;
								int intlvl;
								
								for(int i=0; i<tCategoryLevel.size(); i++){
								    GSManufactureCategoryBean tGSManufactureCategoryBean = (GSManufactureCategoryBean)tCategoryLevel.get(i);
								    lvl=tGSManufactureCategoryBean.getGs_manufacture_level();
								    
									 intlvl= Integer.parseInt(lvl);

									if(intlvl==1)
									{
									//System.out.println(lvl);
						%>
								<option value="<%=tGSManufactureCategoryBean.getGs_manufacture_level()%>,<%=tGSManufactureCategoryBean.getGs_manufacture_category_id()%>">
								  <%=tGSManufactureCategoryBean.getGs_manufacture_level()%> 级|<%=tGSManufactureCategoryBean.getGs_manufacture_category_name()%>
								  </option>
								  
								  <%}
								 }
								 
								 for(int i=0; i<tCategoryLevel.size(); i++){
									GSManufactureCategoryBean tGSManufactureCategoryBean = (GSManufactureCategoryBean)tCategoryLevel.get(i);
								  	lvl=tGSManufactureCategoryBean.getGs_manufacture_level();
								  	intlvl= Integer.parseInt(lvl);
								  if(intlvl==2)
									{
									//System.out.println(lvl);
									%>
									
								<option value="<%=tGSManufactureCategoryBean.getGs_manufacture_level()%>,<%=tGSManufactureCategoryBean.getGs_manufacture_category_id()%>">
								  <%=tGSManufactureCategoryBean.getGs_manufacture_level()%> 级|<%=tGSManufactureCategoryBean.getGs_manufacture_category_name()%>
								  </option>  
						<%			}
								}
							}else{
						%>
								<option value="0">------无------</option>
						<%
							}
						%>
						</select>
				
				</TD>
			</TR>
			<TR class="bg_row_odd" height=20>
				<TD align=right>产品种类描述</TD>
				<TD align=left colspan="3">
				<input type=text name="gs_manufacture_desc" maxlength="50" size=30 />
				</TD>
				
			</TR>
			
		</TABLE>
		</td>
	</tr>
	
</table>

</form>

<!----------------------------------------------------------------------------------------------------------------------------------->
<p align="center">
<input type="button" class="kuang" value="增加" onclick="return check();"> 
<input type="button" class="kuang" value="关闭" onclick="return back();"></p>
<p>
<p>
<p>
<p><br>
<br>
<br>
<br>
<br>
<%} %>
</body>
</html>
